package review;

import java.util.Scanner;

public class SmartControl
{
    public void showAllJD(JD jds[])
    {
        int i = 0;
        for(i = 0;i<jds.length;i++)
        {
            JD jd = jds[i];
            System.out.println((i+1) + "," + jd.getName() + "," + (jd.isStatus() ?"开着" : "关着"));

        }

    }
    public void contr(JD jds[])
    {
        while(true)
        {
            System.out.println("请选择你想操作的家电：");
            Scanner sc = new Scanner(System.in);
            String command  = sc.next();
            switch(command)
            {
                case "1":
                    jds[0].press();
                    break;
                case "2":
                    jds[1].press();
                    break;
                case "3":
                    jds[2].press();
                    break;
                case "4":
                    jds[3].press();
                    break;
                case "exit":
                    System.out.println("退出");
                    return;
                default:
                    System.out.println("输入错误，请重新输入");
                    break;
            }
            showAllJD(jds);
        }
    }
}
